// wave@media.mit.edu 3/24/93
//
#import "WLabeledSlider.h"

@implementation WLabeledSlider

//
- initFrame:(const NXRect *)frameRect
{
  oTheHorrorOfItAll = YES;
  return [super initFrame:frameRect];
}
//
- awake
{
  oTheHorrorOfItAll = YES;
  return [super awake];
}
//
- awakeFromNib
{
  [minText setFloatValue:[self minValue]];
  [maxText setFloatValue:[self maxValue]];
  [valText setFloatValue:[self floatValue]];
  oTheHorrorOfItAll = NO;
  return self;
}
//
- setMinValue:(double)aDouble
{
   [minText setFloatValue:aDouble];
   return [super setMinValue:aDouble];
}
//
- setMaxValue:(double)aDouble
{
   [maxText setFloatValue:aDouble];
   return [super setMaxValue:aDouble];
}
//
// need oTheHorrorOfItAll because there is no equivalent to awakeFromNib inside
// of IB - remember the whole point of this exercise is to let us stay 
// inside  of IB as long as possible...  I've told jmh, but I
// don't know if it will be fixed in 3.1
//
//
- sendAction:(SEL)theAction to:theTarget
{
  if (oTheHorrorOfItAll)
  {  oTheHorrorOfItAll = NO;
     [minText setFloatValue:[self minValue]];
     [maxText setFloatValue:[self maxValue]];
  }
  if (valText)  // this check might save you a msg or two if it's not connected...
  {  [valText setFloatValue:[self floatValue]];
  }
  return [super sendAction:theAction to:theTarget];
}
// do I really need these?  I always forget...
- setMinText:sender {  minText = sender; return self;}
- setMaxText:sender {  maxText = sender; return self;}
- setValText:sender {  valText = sender; return self;}


@end
